package fivecardstudd;
import static org.junit.Assert.*;
import org.junit.Test;
import fivecardstudd.Player.RoundStatus;
import java.util.*;
public class PlayerTest {

	

	@Test
	public void testAddCardToHand() {
		
		Table t2=new Table("Table");
		Player p1=new Player(100,t2);
		System.out.println(p1.getCurrentHand());
		Hand hand=new Hand();
		Card card1=new Card(Card.CardRankEnum.ACE,Card.CardSuitEnum.HEARTS);
		p1.getCurrentHand().addCard(card1);
		hand.addCard(card1);
		System.out.println(hand);
		System.out.println(p1.getCurrentHand());
		assertSame(p1.getCurrentHand(),hand);
		
	}
	@Test
	public void testSetRoundStatus() {
		Table t2=new Table("TABLE");
		Player p1=new Player(100,t2);
		p1.setRoundStatus(RoundStatus.IN_TURN);
		assertSame(RoundStatus.IN_TURN,p1.getRoundStatus());
		
	}

	@Test
	public void testCall() {
		Table t2=new Table("TABLE");
		Player p1=new Player(100,t2);
		p1.call();
		assertSame(RoundStatus.JUST_BET,p1.getRoundStatus());
		
	}
	@Test
	public void testFold() {
		Table t2=new Table("TABLE");
		Player p1=new Player(100,t2);
		p1.fold();
		assertSame(RoundStatus.INACTIVE,p1.getRoundStatus());
		
	}
	@Test
	public void testAllIn() {
		Table t2=new Table("TABLE");
		Player p1=new Player(100,t2);
		p1.allIn();
		assertSame(RoundStatus.JUST_BET,p1.getRoundStatus());
		
	}
	@Test
	public void testRaise() {
		Table t2=new Table("TABLE");
		Player p1=new Player(100,t2);
		p1.raise(20);
		assertSame(RoundStatus.JUST_BET,p1.getRoundStatus());
		
	}
	@Test
	public void testBet() {
		Table t2=new Table("TABLE");
		Player p1=new Player(100,t2);
		p1.bet(40);
		assertSame(p1.getChips(),60);
		
	}
	@Test
	public void testAllInChips() {
		Table t2=new Table("TABLE");
		Player p1=new Player(100,t2);
		p1.allIn();
		assertSame(p1.getChips(),0);
		
	}
	@Test
	public void testIntValueOfCard() {
		
		Table t2=new Table("Table");
		Player p1=new Player(100,t2);
		Card card1=new Card(Card.CardRankEnum.ACE,Card.CardSuitEnum.HEARTS);
		p1.getCurrentHand().addCard(card1);
			System.out.println(p1.getValueOfCard(0));
		assertEquals(p1.getValueOfCard(0),144);
		
	}
}